package cn._2dland.uploader.utils
{
	public class UploaderUtils
	{
		public function UploaderUtils() {
		}
		
		public static function formatPercent(n:Number):String {
			var p:Number = Math.floor(n * 10000) / 100;
			return p + "%";
		}
		
		public static function formatSpeed(n:Number):String {
			var s:Number = Math.round(n / 1024 * 100) / 100;
			return s + "kb/s";
		}

		public static function formatFileSize(n:Number):String {
			var s:Number = Math.round(n / 1024 * 10) / 10;
			var unit:String = " KB";
			if(s>1024){
				s = Math.round(s / 1024 * 10) / 10;
				unit = " MB";
			}
			return s.toString() + unit;
		}
	}
}